import { defineConfig } from 'vite'
import path from 'path';
import vue from '@vitejs/plugin-vue'

// https://vite.dev/config/
export default defineConfig({
  plugins: [vue()],
  resolve: {
    alias: {
      "@": path.resolve(__dirname,'src'),
    }
  },
  server: {
    proxy: {
      '/api': {
        target: 'http://127.0.0.1:8823',
        changeOrigin: true,
        rewrite: (path) => path.replace(/^\/api/, '')
      }
    }
  }
  // server: {
  //   proxy: {
  //    '/api': {//匹配/api开头的请求
  //       target:'http://127.0.0.1:8824',//转发的目标服务器​    
  //       changeOrigin: true,//允许跨域
  //       rewrite: (path) => path.replace(/^\/api/, '')
  //     }
  //   }
  // }
})
